package com.ysm.smfu.bean;

import com.ysm.smfu.utils.PinYinUtils;

import java.io.Serializable;

/**
 * Created by Administrator on 2016/10/25.
 */
public class Friend implements Serializable, Comparable<Friend> {
    private static final long serialVersionUID = 1905122041950251207L;
    public String id;
    public String pwd;
    public String loginId;
    public String sex;
    public String birthday;
    public String address;
    public String petName;
    public String phone;
    public String hxId;
    public String is_business;
    public String lastloginTime;
    public String imageAddress;
    public String codePre;
    public String codeSuf;
    public String agent;
    //    等级
    public String level;
    String pinyin;
    //    申请状态
    public String applyState;

    public String getPinYin() {
        String asgsd = PinYinUtils.getPinYin(petName);
        if (asgsd.length() > 0) {
            pinyin = asgsd;
        } else {
            if (Character.isDigit(petName.charAt(0))) {
                pinyin = "#";
            } else if (Character.isLetter(petName.charAt(0))) {
                pinyin = petName;
            }
        }
        String lowerCase="#";
        if (pinyin != null)
            lowerCase = pinyin.toUpperCase();
        return String.valueOf(lowerCase.charAt(0));
    }

    public String getPY() {
        String asgsd = PinYinUtils.getPinYin(petName);
        if (asgsd.length() > 0) {
            pinyin = asgsd;
        } else {
            if (Character.isDigit(petName.charAt(0))) {
                pinyin = "#0";
            } else if (Character.isLetter(petName.charAt(0))) {
                pinyin = petName;
            }
        }
        String lowerCase="#";
        if (pinyin != null)
            lowerCase = pinyin.toUpperCase();
        return lowerCase;
    }

    // 如果是商户则有商户ID
    public String businessId;

    @Override
    public int compareTo(Friend another) {
        return this.getPY().compareTo(another.getPY());
    }

    @Override
    public String toString() {
        return "Friend{" +
                "id='" + id + '\'' +
                ", loginId='" + loginId + '\'' +
                ", petName='" + petName + '\'' +
                ", phone='" + phone + '\'' +
                ", hxId='" + hxId + '\'' +
                ", level='" + level + '\'' +
                '}';
    }
}